#ifndef KMYWORLD_H
#define KMYWORLD_H

#include "../KmyStructDef.h"
#include "KmyMap.h"
#include "KmySprite.h"
#include "KmyNodeLayer.h"

/**
  * 地图，精灵都挂在world下
  */
class KmyWorld : public KmyNodeLayer
{
public:
    KmyWorld();
    KmyWorld(int W, int H);
    virtual ~KmyWorld();

    void initalize(int w, int h);
    void finalize();

    void setCameraRange(int w, int h);
    void setCameraCenter(int x, int y);
    St_Rect* getCamera();

    int getWorldWidth();
    int getWorldHeight();

//    void setMap(int id, KmyMap* map);
//    KmyMap* getMap(int id);

    void addMap(KmyMap *map);
    void removeMap(KmyMap *map);
    KmyMap* getMap(int index);

    void logic();
    void render(KmyICanvas* screen);

    int getGlobalX();
    int getGlobalY();
private:
    int world_W;
    int world_H;
    St_Rect camera;
//    int map_len; //有几层map
//    KmyMap** maps;
};

#endif // KMYWORLD_H
